package org.nf.shopping.controller;

import com.github.pagehelper.PageInfo;
import lombok.RequiredArgsConstructor;
import org.nf.shopping.common.vo.ResultVO;
import org.nf.shopping.entity.DisPatChe;
import org.nf.shopping.service.DisPatCheService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @Author czl
 * @Date 2024-12-03
 */
@RestController
@RequiredArgsConstructor
@RequestMapping("/disPatChe")
public class DisPatCheController extends BaseController{
    private final DisPatCheService disPatCheService;

    @GetMapping("/listDisPatChe")
    public ResultVO<PageInfo<DisPatChe>> listDisPatChe(Integer limit, Integer page, String typeName){
        PageInfo<DisPatChe> pageInfo = disPatCheService.listDisPatChe(limit, page, typeName);
        return success(pageInfo);
    }

    @PostMapping("/updateDisPatChe")
    public ResultVO updateDisPatChe(DisPatChe disPatChe){
        disPatCheService.updateDisPatChe(disPatChe);
        return success();
    }

    @PostMapping("/deloneDisPatChe")
    public ResultVO deloneDisPatChe(Integer id){
        disPatCheService.deloneDisPatChe(id);
        return success();
    }

    @PostMapping("/addDisPatChe")
    public ResultVO addDisPatChe(DisPatChe disPatChe){
        disPatCheService.addDisPatChe(disPatChe);
        return success();
    }

    @PostMapping("/getDisPatCheList")
    public ResultVO<List<DisPatChe>> getDisPatCheList(){
        return success(disPatCheService.getDisPatCheList());
    }
}
